package com.cjm.one.system.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.system.dto.SysDictDataDto;
import com.cjm.one.model.system.entity.SysDictData;
import com.cjm.one.model.system.entity.SysDictType;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_SYSTEM)
public interface SysDictClient {
    @PostMapping("/admin/system/dict/type/findAll")
    @Tag(name = "查询所有字典的类型")
    Result<List<SysDictType>> findAll(@RequestBody SysDictDataDto sysDictDataDto);

    @PostMapping("/admin/system/dict/type")
    @Operation(description = "新增字典类型")
    Result<Boolean> saveDictType(@RequestBody SysDictType sysDictType);

    @PutMapping("/admin/system/dict/type")
    @Operation(description = "修改字典类型")
    Result<Boolean> updateSysDictTypeById(@RequestBody SysDictType sysDictType);

    @DeleteMapping("/admin/system/dict/type")
    @Operation(description = "删除字典类型")
    Result<Boolean> removeSysDictTypeById(@RequestBody SysDictDataDto sysDictDataDto);

    @GetMapping("/admin/system/dict/type/{id}")
    @Operation(description = "根据id查询字典类型")
    Result<SysDictType> findSysDictTypeById(@PathVariable("id") Long id);

//    ======================================================================

    @PostMapping("/admin/system/dict/data/list")
    @Operation(summary = "分页字典数据列表")
    Result<Page<SysDictData>>  list(@RequestBody SysDictDataDto sysDictDataDto);

    @PostMapping("/admin/system/dict/data")
    @Operation(summary = "保存字典数据")
    Result<Boolean> saveDictData(@RequestBody SysDictData sysDictData);

    @PutMapping("/admin/system/dict/data")
    @Operation(summary = "修改字典数据")
    Result<Boolean> updateDictData(@RequestBody SysDictData sysDictData);

    @DeleteMapping("/admin/system/dict/data/{id}")
    @Operation(summary = "删除字典数据")
    Result<Boolean> deleteDictData(@PathVariable Long id);
    @GetMapping("/admin/system/dict/data/{id}")
    @Operation(summary = "根据id查询字典数据")
    Result<SysDictData> getDictDataById(@PathVariable Long id);
}
